using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Ent.Web.Helper;

public partial class Controls_ChangeLanguage : System.Web.UI.UserControl
{
    public Controls_ChangeLanguage()
    {
        this.Load += new EventHandler(Controls_ChangeLanguage_Load);
    }

    void Controls_ChangeLanguage_Load(object sender, EventArgs e)
    {
        PupulateLanguage();
    }
    private void PupulateLanguage()
    {
        System.Collections.Generic.Dictionary<string, string> lang = ResourceHelper.GetLanguages();
        foreach(string key in lang.Keys)
        {
            LinkButton lnk = new LinkButton();
            lnk.Text = key;
            lnk.Font.Size = FontUnit.Smaller;
            lnk.ForeColor = System.Drawing.Color.Gray;
            lnk.Command += new CommandEventHandler(lnk_Command);
            lnk.CommandName = "ChangeLanguage";
            lnk.CommandArgument = lang[key];
            pnlLanguage.Controls.Add(lnk);
            Label lbl = new Label();
            lbl.Text = "&nbsp;&nbsp;";
            pnlLanguage.Controls.Add(lbl);
        }
    }
    void lnk_Command(object sender, CommandEventArgs e)
    {
        Session["Lang"] = e.CommandArgument.ToString();
    }
}
